<template>
  <div>
    <table>
      <tr>
        <td>用户名</td>
        <td><input type="text" v-model="username"></td>
      </tr>
      <tr>
        <td>密码</td>
        <td><input type="text" v-model="password"></td>
      </tr>
      <tr>
        <td><button @click="reg">注册</button></td>
      </tr>
    </table>
  </div>
</template>

<script>
    export default {
        name: "Reg2",
      data:function () {
        return{
          username:'',
          password:''
        }
      },
      methods:{
        reg:function () {
          this.axios.get(
              'http://127.0.0.1:8000/reg2/',
              {params:{username: this.username, password: this.password}}
              ).then(res=>{
                console.log(res)
              this.$Message(res.data.msg)
              if(res.data.code==200){
                alert(res.data.msg)
                this.$router.push('Login2')
              }
            })
        }
      }
    }
</script>

<style scoped>

</style>
